package com.edu.bean;


import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * @Auther:zzp
 * @Date:2025/11/3-17:14:08
 */
@Component
public class MyDataSource {

    @Value("${db.username}")
    private String  username;

    @Value("${password}")
    private String password;

    @Value("${url}")
    private String url;

    @Value("${driver}")
    private String driver;

    public String  getUsername() {
        return username;
    }

    public void setUsername(String  username) {
        this.username = username;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public String getDriver() {
        return driver;
    }

    public void setDriver(String driver) {
        this.driver = driver;
    }

    @Override
    public String toString() {
        return "MyDataSource{" +
                "username=" + username +
                ", password='" + password + '\'' +
                ", url='" + url + '\'' +
                ", driver='" + driver + '\'' +
                '}';
    }


    public void getConnection(){
        System.out.println("执行了getConnection方法");
    }
}
